Skip to content

Conversation

@josedonizetti
Copy link
Collaborator

@josedonizetti josedonizetti commented Oct 29, 2025

Changes:

  • New flag format: Changed from --log level:debug to --log level=debug
  • Structured filters: Changed from --log filter:msg=error to --log filter.include.msg=error
  • Level field rename: Changed level: to lvl: in config for consistency
  • Consistent syntax: All log options now use dot notation for hierarchy and equals for values
  • Added constants: Defined all log flag constants for maintainability
  • Updated parsing: Refactored PrepareLogger to handle new structured format
  • Fixed bugs: Resolved issues with multiple filter options not being applied correctly

Examples:

Old flag format (deprecated):

--log level:debug
--log file:/tmp/tracee.log  
--log aggregate:5s
--log filter:msg=error,pkg=core
--log filter-out:lvl=debug

New flag format:

--log level=debug
--log file=/tmp/tracee.log
--log aggregate.enabled=true --log aggregate.flush-interval=5s
--log filters.include.msg=error --log filters.include.pkg=core
--log filters.exclude.lvl=debug

Old config format (deprecated):

log:
  level: debug
  file: /tmp/tracee.log
  filters:
    msg: [foo, bar]
    level: [error]
  filter-out:
    level: [debug]

New config format:

log:
  level: debug
  file: /tmp/tracee.log
  filters:
    include:
      msg:
        - foo
        - bar
      lvl:
        - error
    exclude:
      lvl:
        - debug

Testing: All existing tests updated + comprehensive test coverage for new format.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 56.98324% with 77 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@0b8ac82). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/cmd/flags/logger.go 52.94% 59 Missing and 13 partials ⚠️
cmd/tracee/cmd/root.go 0.00% 3 Missing ⚠️
cmd/tracee/cmd/analyze.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4999   +/-   ##
=======================================
  Coverage        ?   29.64%           
=======================================
  Files           ?      234           
  Lines           ?    26197           
  Branches        ?        0           
=======================================
  Hits            ?     7767           
  Misses          ?    17882           
  Partials        ?      548           
Flag Coverage Δ
unit 29.64% <56.98%> (?)
Files with missing lines Coverage Δ
cmd/tracee-ebpf/main.go 0.00% <ø> (ø)
pkg/cmd/cobra/config.go 89.25% <100.00%> (ø)
cmd/tracee/cmd/analyze.go 32.52% <66.66%> (ø)
cmd/tracee/cmd/root.go 0.00% <0.00%> (ø)
pkg/cmd/flags/logger.go 55.36% <52.94%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josedonizetti josedonizetti force-pushed the newLogFlag branch 2 times, most recently from 26eec40 to 1f7f81c Compare October 30, 2025 18:52
@josedonizetti josedonizetti changed the title New log flag Refactor log flag to new structured Oct 30, 2025
@josedonizetti josedonizetti marked this pull request as ready for review October 30, 2025 19:21
@josedonizetti josedonizetti changed the title Refactor log flag to new structured Refactor log flag to new structure Oct 30, 2025
@yanivagman
Copy link
Collaborator

Overall LGTM, but:

  1. Looks like some commits should be squashed (currently 19 commits for this change, including commits like "fix PR review comments")
  2. Why did we change level to lvl? Don't we want to be explicit with level?

@josedonizetti josedonizetti changed the title Refactor log flag to new structure flag(log): new flag format Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants